home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / bc_pas_1.zip / FMEMCPY.ASM < prev    next >
Assembly Source File  |  1992-09-03  |  3KB  |  175 lines

  1. ;$Author:   DCODY  $
  2. ;$Date:   03 Sep 1992 14:57:04  $
  3. ;$Header:   X:/sccs/misc/fmemcpy.asv   1.3   03 Sep 1992 14:57:04   DCODY  $
  4. ;$Log:   X:/sccs/misc/fmemcpy.asv  $
  5. ;  
  6. ;     Rev 1.3   03 Sep 1992 14:57:04   DCODY
  7. ;  added huge memory block copy
  8. ;  
  9. ;     Rev 1.2   24 Jul 1992 15:39:30   DCODY
  10. ;  renamed the function name, from _fmemcpy, to _rfmemcpy
  11. ;  
  12. ;     Rev 1.1   23 Jun 1992 16:32:38   DCODY
  13. ;  PAS2 update
  14. ;  
  15. ;     Rev 1.0   15 Jun 1992 09:39:50   BCRANE
  16. ;  Initial revision.
  17. ;$Logfile:   X:/sccs/misc/fmemcpy.asv  $
  18. ;$Modtimes$
  19. ;$Revision:   1.3  $
  20.  
  21.         page    64,131
  22.     Title    fmemcpy  --  memory to memory copy
  23.  
  24. ;   /*\
  25. ;---|*|
  26. ;---|*|------------====< FMEMCPY.ASM >====------------
  27. ;---|*|
  28. ;---|*| Copyright (c) 1991, Media Vision, Inc. All rights reserved
  29. ;---|*|
  30. ;   \*/
  31.  
  32.     .xlist
  33.     include model.inc
  34.     include masm.inc
  35.         include common.inc
  36.     .list
  37.  
  38.         .code
  39.  
  40. ;
  41. ;   /*\
  42. ;---|*|
  43. ;---|*|------------====< void rfmemcpy ( void far *, void far *, int ) >====------------
  44. ;---|*|
  45. ;---|*| Our memory to memory copy - Copy from the source pointer to the
  46. ;---|*| target pointer of xxx length
  47. ;---|*|
  48. ;---|*| Entry Conditions:
  49. ;---|*|     dParm1 - Target far pointer
  50. ;---|*|     dParm2 - Source far pointer
  51. ;---|*|     wParm3 - Size of block move
  52. ;---|*|
  53. ;---|*| Exit Conditions:
  54. ;---|*|     returns the ending target pointer
  55. ;---|*|
  56. ;---|*| Functionality:
  57. ;---|*|
  58. ;---|*|     Clear interrupt mechanisms.
  59. ;---|*|     Disable DMA channel.
  60. ;---|*|     Set DMARunning to 0;
  61. ;---|*|
  62. ;   \*/
  63.  
  64.     public    _rfmemcpy
  65. _rfmemcpy    proc
  66.     push    bp
  67.     mov    bp,sp
  68.     push    ds
  69.     push    es
  70.     push    si
  71.     push    di
  72.  
  73.     pushf
  74.     les    di,dParm1
  75.     lds    si,dParm2
  76.     mov    cx,wParm5        ; use wParm5 to access 5th word
  77.  
  78.         cld
  79.     rep    movsb
  80.  
  81.     mov    dx,es            ; return the ending ptr
  82.     mov    ax,di
  83.  
  84.         popf
  85.  
  86.     pop    di
  87.     pop    si
  88.     pop    es
  89.     pop    ds
  90.     pop    bp
  91.     ret
  92.  
  93. _rfmemcpy    endp
  94.  
  95.  
  96. ;
  97. ;   /*\
  98. ;---|*|
  99. ;---|*|------------====< void rfhmemcpy ( void huge*, void huge*, int ) >====------------
  100. ;---|*|
  101. ;---|*| Our huge pointer memory to memory copy - Copy from the source
  102. ;---|*| pointer to the target pointer of xxx length
  103. ;---|*|
  104. ;---|*| Entry Conditions:
  105. ;---|*|     dParm1 - Target far pointer
  106. ;---|*|     dParm2 - Source far pointer
  107. ;---|*|     wParm3 - Size of block move
  108. ;---|*|
  109. ;---|*| Exit Conditions:
  110. ;---|*|     returns the ending target pointer
  111. ;---|*|
  112. ;---|*| Functionality:
  113. ;---|*|
  114. ;---|*|     Clear interrupt mechanisms.
  115. ;---|*|     Disable DMA channel.
  116. ;---|*|     Set DMARunning to 0;
  117. ;---|*|
  118. ;   \*/
  119.  
  120.     public    _rfhmemcpy
  121. _rfhmemcpy     proc
  122.     push    bp
  123.     mov    bp,sp
  124.  
  125.         push    ds
  126.     push    es
  127.     push    si
  128.     push    di
  129.  
  130.     pushf
  131.     cld
  132.  
  133.     les    di,dParm1        ; get the huge target pointer
  134.     lds    si,dParm2        ; get the huge source pointer
  135.     mov    cx,wParm5        ; use wParm5 to access 5th word
  136. ;
  137. hcpy:
  138.     movsb
  139.     or    si,si            ; source wrapped?
  140.     jz    srcwrap         ; yes, go adjust it...
  141.    sret:
  142.     or    di,di            ; destination wrapped?
  143.     jz    trgwrap         ; yes, go adjust it...
  144.    tret:
  145.     loop    hcpy            ; do the whole block
  146.  
  147.     mov    dx,es            ; return the ending target ptr
  148.     mov    ax,di
  149.  
  150.         popf
  151.  
  152.     pop    di
  153.     pop    si
  154.     pop    es
  155.     pop    ds
  156.     pop    bp
  157.     ret
  158. ;
  159. srcwrap:
  160.     mov    ax,ds
  161.     add    ax,1000h
  162.     mov    ds,ax
  163.         jmp     short sret
  164. ;
  165. trgwrap:
  166.     mov    ax,es
  167.     add    ax,1000h
  168.     mov    es,ax
  169.     jmp    short tret
  170.  
  171. _rfhmemcpy     endp
  172.  
  173.     end
  174.  
  175.